package com.li.onjava8.concurrent.es;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author li
 * @date 2023/10/30 14:45
 */

class NotRunnable {
    public void go() {
        System.out.println("NotRunnable");
    }
}
class NotCallable {
    public Integer get() {
        System.out.println("NotCallable");
        return 1;
    }
}

public class LambdasAndMethodReferences {
    public static void main(String[] args) {
        ExecutorService es = Executors.newCachedThreadPool();
        es.submit(new NotRunnable()::go);
        es.submit(new NotCallable()::get);
        es.submit(() -> System.out.println("lambda runnable"));
        es.submit(() -> {
            System.out.println("lambda callable");
            return 1;
        });
        es.shutdown();
    }
}

